const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack');
const {serverIp} = require("./public/config.js");

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 8079, // 指定前端开发服务器的端口号
    //开启代理
    proxy: {
      '/jdyfy': {
        target: `http://${serverIp}:8081`,// 后端服务器地址
        changeOrigin: true,// 允许跨域
        pathRewrite: {
          '^/api': ''// 将 /api 前缀去掉
        }
      }
    }
  },
  configureWebpack: {
    resolve: {
      fallback: {
        net: require.resolve('node-libs-browser/mock/net')
      }
    },
    plugins: [
      new webpack.ProvidePlugin({
        process: 'process/browser',
      })
    ]
  }
})
